<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>登记-安平县居民核酸检测信息系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="layui/css/layui.css"  media="all">
  <script src="https://cdn.bootcdn.net/ajax/libs/fastclick/1.0.6/fastclick.js"></script>
  <script src="jquery.min.js"></script>
  <script src="fn.js"></script>
</head>
  <style>
      .button{
          width: 340px;
          height: 44px;
          margin: 0 auto;
          display: flex;
          justify-content: center;
          align-items: center;
          box-shadow: 0 1px 4px #ccc;
          margin-bottom: 15px;
          color: #009688;
          font-weight: bold;
          margin-top: 24px;
      }
      .button img{
          margin-right: 5px;
      }
      .tips{
          width: 340px;
          color: #999;
          margin: 0 auto;
      }
      .red{
          color: red;
      }
      .search{
            width: 340px;
            height: 50px;
            box-shadow: 0 1px 4px red;
            display: flex;
            justify-content: center;
            align-items: center;
            margin: 0 auto;
            font-family: HiraginoSansGB-W3;
            color: #999999;
            margin-bottom: 24px;
        	color:red;
        	font-size:16px;
      }
      .search img{
          margin-left: 5px;
      }
      .h1{
          text-align: center;
          font-size: 22px;
          font-weight: bold;
          margin: 26px 0;
      }
      ul li{
          width: 310px;
          display: flex;
          justify-content: space-between;
          height: 44px;
          box-shadow: 0 1px 4px #ccc;
          margin: 0 auto;
          margin-top: 15px;
          padding: 10px 15px;
          align-items: center;
      }
      ul li .name{
          margin-bottom: 6px;
          font-size: 16px;
      }
      ul li .idCard{
          color: #666;
      }
      ul li .r{
          width: 80px;
          height: 25px;
          background-color: #ccc;
          color: #fff;
          display: flex;
          justify-content: center;
          align-items: center;
          border-radius: 5px;
        
      }
      .copy{
            text-align: center;
            width: 100%;
        }
      .layBox{
          min-height: 580px;
          overflow: hidden;
      }
  </style>
<body>
    
    <div class="layBox">
        <div class="h1">人员信息</div>
        <a href="http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/register_v2/search_user.html" class="search">已注册人员信息搜索绑定/新人注册<img src="images/ss.png" width="18" /></a>
        <ul class="list_ul">
            <!-- <li>
                <div class="l">
                    <div class="name">张超</div>
                    <div class="idCard">131125199910030034</div>
                </div>
                <div class="r">
                    解除绑定
                </div>
            </li> -->
        </ul>
      	<!--
        <a class="button" href="http://hesuan.city1000.cn/register_v2/register_select_url.html"><img src="images/lvse.png" width="20" />新注册人员信息</a>
		-->
    </div>
    <div class="copy">
        <p>安平县新冠肺炎疫情防控工作指挥部</p>
        <p>技术支持：智慧安平</p>
    </div>
<script src="layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
layui.use(['form', 'layer', 'jquery'], function(){
  var form = layui.form
  ,layer = layui.layer
  ,$ = layui.jquery;
})
var code = getUrlName('code');
if(code == null || code == "" || code == undefined){
    $("body").html("请在微信客户端打开链接")
}else{
    $(".list_ul").html("");
    $.ajax({
        url: "http://user.city1000.cn:9999/hesuan/api/getUserListByCode",
        type: "GET",
        dataType: "json",
        data: {
            'wxcode': code
        },
        success: function (res) {
            if(res.code == 4002){
                $(location).attr("href", "http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/register_v2/register_index.html");
            }
            if(res.data.length > 0){
                for(var i=0; i<res.data.length; i++){
                    var html = "<li><div class='l'><div class='name'>"+res.data[i].name+"</div><div class='idCard'>"+res.data[i].idCard+"</div></div><div class='r jiechubangding' _key='"+res.data[i].idx+"'>解除绑定</div></li>";

                    $(".list_ul").append(html);
                    //http://user.city1000.cn:9999/hesuan/api/unBindUser
                }

                var jiechu = $(".jiechubangding");
                jiechu.unbind("click");
                jiechu.click(function(){
                    var ts = $(this);
                    $.ajax({
                        url: "http://user.city1000.cn:9999/hesuan/api/unBindUser",
                        type: "GET",
                        dataType: "json",
                        data: {
                            'idx': ts.attr("_key")
                        },
                        success: function (res) {
                            if(res.code == 0){
                                layer.msg(res.msg);
                                setTimeout(function(){
                                    $(location).attr("href", "http://user.city1000.cn:9999/weixin/wechat/h5/redirectSomeWhere?url=http://hesuan.city1000.cn/register_v2/register_index.html");
                                }, 1000)
                            }
                            console.log(res)
                        }
                    })
                });

            }
            
        }
    })
}


</script>

</body>
</html>